import React from 'react';
import classNames from 'classnames';
import { WeaLocaleProvider } from 'ecCom';
import GovernTag from '../governPoint/tag';
const getLabel = WeaLocaleProvider.getLabel;

export default class ListItem extends React.Component {
    onClick = () => {
        const { data, onClick } = this.props
        onClick && onClick(data);
    }

    render() {
        const { data, currentKey } = this.props;
        const className = classNames('prj-list-item-content');
        let isCurrent = currentKey && currentKey == data.prjid;
        return (
            <div
                component="span"
                className="prj-list-item"
                onClick={this.onClick}
            >
                <div style={isCurrent ? { 'background-color': '#def0ff' } : {}}>
                    <div className={className}>
                        {/* <div className="name-state" style={{ backgroundColor: data.color }}>{data.state}</div> */}
                        <GovernTag ecId={`${this && this.props && this.props.ecId || ''}_GovernTag@8h9nxz`} record={data} custyle ={{'float':'right'}}/>
                        <div className="prj-list-item-content-top">
                            <div className="name-wrapper" title={data.name}>{data.name}</div>
                            <div className="subname-wrapper">
                                <span>{`${getLabel('84043', "责任人") + " : " + data.person}`}</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        )
    }
}

